//
//  SGJTaskExamineCell.m
//  Sewage
//
//  Created by 优聚泰元 on 2017/6/7.
//  Copyright © 2017年 宗庆猛. All rights reserved.
//

#import "SGJTaskExamineCell.h"

#import <UIImageView+WebCache.h>

@interface SGJTaskExamineCell ()
@property (weak, nonatomic) IBOutlet UIButton *noarmalButton;
@property (weak, nonatomic) IBOutlet UIButton *troubleButton;
@property (weak, nonatomic) IBOutlet UILabel *deviceNameLabel;
@property (weak, nonatomic) IBOutlet UIImageView *deviceImageView;
@property (weak, nonatomic) IBOutlet UILabel *poiAddressLabel;

@end

@implementation SGJTaskExamineCell
- (IBAction)normalButtonClick:(UIButton *)sender {
    if ([self.delegate respondsToSelector:@selector(normalButtonClickWithTaskExamineCell:)]) {
        [self.delegate normalButtonClickWithTaskExamineCell:self];
    }
    
}
- (IBAction)troubleButtonClick:(UIButton *)sender {
    if ([self.delegate respondsToSelector:@selector(troubleButtonClickWithTaskExamineCell:)]) {
        [self.delegate troubleButtonClickWithTaskExamineCell:self];
    }
    
}
- (IBAction)mapButtonClick:(UIButton *)sender {
    if ([self.delegate respondsToSelector:@selector(mapButtonClickWithTaskExamineCell:)]) {
        [self.delegate mapButtonClickWithTaskExamineCell:self];
    }
}

-(void)setPoiModel:(SGJPoiModel *)poiModel{

    _poiModel = poiModel;
    
    self.deviceNameLabel.text = poiModel.deviceName;
    self.poiAddressLabel.text = poiModel.poiAddress;
    NSString *imageUrlStr = [NSString stringWithFormat:@"%@%@",@"http://oowmepah0.bkt.clouddn.com/",poiModel.deviceImage];
    [self.deviceImageView sd_setImageWithURL:[NSURL URLWithString:imageUrlStr] placeholderImage:[UIImage imageNamed:@""]];
}

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
    
    self.noarmalButton.layer.cornerRadius= 10;
    self.noarmalButton.layer.borderWidth = 1;
    self.noarmalButton.layer.borderColor = [UIColor blueColor].CGColor;
    self.noarmalButton.clipsToBounds = YES;
    
    self.troubleButton.layer.cornerRadius = 10;
    self.troubleButton.layer.borderWidth = 1;
    self.troubleButton.layer.borderColor = [UIColor blueColor].CGColor;
    self.troubleButton.clipsToBounds = YES;
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
